package com.example.gameforum.service;


import com.example.gameforum.dao.PostDao;
import com.example.gameforum.entity.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PostService {

    @Autowired
    private PostDao postDao;

    public void insertPost(Post post){
        postDao.save(post);
    }

    public List<Post> getAllPost(){
        return postDao.findAll();
    }

    public Post getById(int id){
        return postDao.getOne(id);
    }
}
